//package com.zjsystem.zjsy.controller;
//
//
//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
//import com.baomidou.mybatisplus.core.toolkit.StringUtils;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.zjsystem.zjsy.dto.*;
//import com.zjsystem.zjsy.result.Result;
//import com.zjsystem.zjsy.service.ZjActionService;
//import com.zjsystem.zjsy.service.ZjPlanLogService;
//import com.zjsystem.zjsy.vo.PlanVO;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.BeanUtils;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * <p>
// * 筹划记录表 前端控制器
// * </p>
// *
// * @author wyf
// * @since 2024-06-20
// */
//@Slf4j
//@RestController
//@RequestMapping("/zjsy/zjPlanLog")
//public class ZjPlanLogController {
//
//    @Resource
//    private ZjPlanLogService planLogService;
//    @Resource
//    private ZjActionService actionService;
//
//    @ApiModelProperty("筹划方案展示")
//    @GetMapping("/PlanLogList")
//    public Result PlanLogList(@RequestParam("taskId") String taskId) {
//        log.info("入参任务id为：{}", taskId);
//        List<PlanVO> result = new ArrayList<>();
//        try {
//            List<ZjPlanLog> planLogs = planLogService.list(Wrappers.<ZjPlanLog>lambdaQuery()
//                    .eq(ZjPlanLog::getTaskId, taskId));
//            if (CollectionUtils.isEmpty(planLogs)) {
//                return Result.ok(result);
//            }
//            List<String> planIds = planLogs.stream().map(ZjPlanLog::getId).collect(Collectors.toList());
//            List<ZjAction> actionList = actionService.list(Wrappers.<ZjAction>lambdaQuery()
//                    .in(ZjAction::getPlanId, planIds));
//            List<ZjAction> actions = new ArrayList<>();
//            planLogs.forEach(plan -> {
//                String planId = plan.getId();
//                PlanVO vo = new PlanVO();
//                BeanUtils.copyProperties(plan, vo);
//                actionList.forEach(action -> {
//                    Long actionPlanId = action.getPlanId();
//                    if (StringUtils.isNotBlank(actionPlanId) && actionPlanId.equals(planId)) {
//                        actions.add(action);
//                    }
//                });
//                vo.setPlanAction(actions);
//                result.add(vo);
//            });
//            return Result.ok(result);
//        } catch (Exception e) {
//            log.error(e.getMessage());
//            return Result.fail(e.getMessage());
//        }
//    }
//
//}
//
